package com.javafish.webhello;

import com.javafish.webhello.Bean.Media;
import com.javafish.webhello.mapper.MediaMapper;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;
import java.util.List;

public class QueryAllMedia {
    @Test
    public void queryallmedia(){
        System.out.println("start-------------------------");
        //初始化容器
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-mybatis.xml");
        //获得bean
        MediaMapper mediaMapper = ctx.getBean(MediaMapper.class);

        List<Media> medialist = mediaMapper.queryAll();
        for(Media i: medialist){
            System.out.println("media: "+i.getMedia_id());
            System.out.println("type: "+i.getType());
            System.out.println("created_time: "+i.getCreated_time());
            System.out.println("status: "+i.getStatus());
            System.out.println();
        }
        System.out.println(medialist);
    }


}
